﻿using Furion.DependencyInjection;
using Furion.Logging;
using Furion.TaskScheduler;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Err.DatabaseLogging
{
    public class DemoWorker : ISpareTimeWorker
    {
        /// <summary>
        /// Test
        /// </summary>
        /// <param name="timer"></param>
        /// <param name="count"></param>
        [SpareTime(1000, "Test", Description = "测试方法", StartNow = false, ExecuteType = SpareTimeExecuteTypes.Serial)]
        public async void Test(SpareTimer timer, long count)
        {
            Scoped.Create((_, scope) =>
            {
                try
                {
                    //这里会报错 ： System.AggregateException:“An error occurred while writing to logger(s). (Cannot access a disposed object. ObjectDisposed_ObjectName_Name)”
                    Log.Error("LogTest");
                }
                catch (Exception ex)
                { 
                    
                }
            });
        }
    }
}
